<?php

namespace app\controller;

use app\BaseController;
use think\Request;
use think\facade\Db;
use think\facade\Log;
use think\response\Json;
use app\controller\Response\TradeWechatJsapiPayResponse;
use AlipayTradePrecreateRequest;
use AopClient;
use GuzzleHttp\Client;
use Throwable;

class Crontab extends BaseController
{

        //写一个方法 接收账号id 更新 updated_at
        public function updateAccount(Request $request): Json
        {
            try {
                $param = $request->param();
                $id = $param['id'] ?? '';
                if (empty($id)) {
                    return json(['code' => -1, 'msg' => 'ID不能为空']);
                }
                Db::name('game_account')->where('id', $id)->update(['status' => "USING",'updated_at' => date('Y-m-d H:i:s')]);
                return json(['code' => 0, 'msg' => '更新成功']);
            } catch (\Exception $e) {
                return json(['code' => -1, 'msg' => '更新失败：' . $e->getMessage()]);
            }
        }

}
